{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np \n",
    "from keras.models import Sequential\n",
    "from keras.layers import Dense\n",
    "from keras.layers import LSTM\n",
    "import scipy.signal as sig\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "from sklearn.model_selection import train_test_split"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<svg height=\"1300pt\" viewBox=\"0.00 0.00 998.00 1300.00\" width=\"998pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       "<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 1296)\">\n",
       "<title>G</title>\n",
       "<polygon fill=\"white\" points=\"-4,4 -4,-1296 994,-1296 994,4 -4,4\" stroke=\"none\"/>\n",
       "<!-- 140152109471168 -->\n",
       "<g class=\"node\" id=\"node1\"><title>140152109471168</title>\n",
       "<polygon fill=\"none\" points=\"37,-1245.5 37,-1291.5 300,-1291.5 300,-1245.5 37,-1245.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"99.5\" y=\"-1264.8\">input_7: InputLayer</text>\n",
       "<polyline fill=\"none\" points=\"162,-1245.5 162,-1291.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"189.5\" y=\"-1276.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"162,-1268.5 217,-1268.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"189.5\" y=\"-1253.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"217,-1245.5 217,-1291.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"258.5\" y=\"-1276.3\">(None, 100)</text>\n",
       "<polyline fill=\"none\" points=\"217,-1268.5 300,-1268.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"258.5\" y=\"-1253.3\">(None, 100)</text>\n",
       "</g>\n",
       "<!-- 140152109473072 -->\n",
       "<g class=\"node\" id=\"node2\"><title>140152109473072</title>\n",
       "<polygon fill=\"none\" points=\"45,-1162.5 45,-1208.5 292,-1208.5 292,-1162.5 45,-1162.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"99.5\" y=\"-1181.8\">dense_21: Dense</text>\n",
       "<polyline fill=\"none\" points=\"154,-1162.5 154,-1208.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"181.5\" y=\"-1193.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"154,-1185.5 209,-1185.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"181.5\" y=\"-1170.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"209,-1162.5 209,-1208.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"250.5\" y=\"-1193.3\">(None, 100)</text>\n",
       "<polyline fill=\"none\" points=\"209,-1185.5 292,-1185.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"250.5\" y=\"-1170.3\">(None, 100)</text>\n",
       "</g>\n",
       "<!-- 140152109471168&#45;&gt;140152109473072 -->\n",
       "<g class=\"edge\" id=\"edge1\"><title>140152109471168-&gt;140152109473072</title>\n",
       "<path d=\"M168.5,-1245.37C168.5,-1237.15 168.5,-1227.66 168.5,-1218.73\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"172,-1218.61 168.5,-1208.61 165,-1218.61 172,-1218.61\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140152109471896 -->\n",
       "<g class=\"node\" id=\"node3\"><title>140152109471896</title>\n",
       "<polygon fill=\"none\" points=\"45,-1079.5 45,-1125.5 292,-1125.5 292,-1079.5 45,-1079.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"99.5\" y=\"-1098.8\">dense_22: Dense</text>\n",
       "<polyline fill=\"none\" points=\"154,-1079.5 154,-1125.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"181.5\" y=\"-1110.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"154,-1102.5 209,-1102.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"181.5\" y=\"-1087.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"209,-1079.5 209,-1125.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"250.5\" y=\"-1110.3\">(None, 100)</text>\n",
       "<polyline fill=\"none\" points=\"209,-1102.5 292,-1102.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"250.5\" y=\"-1087.3\">(None, 100)</text>\n",
       "</g>\n",
       "<!-- 140152109473072&#45;&gt;140152109471896 -->\n",
       "<g class=\"edge\" id=\"edge2\"><title>140152109473072-&gt;140152109471896</title>\n",
       "<path d=\"M168.5,-1162.37C168.5,-1154.15 168.5,-1144.66 168.5,-1135.73\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"172,-1135.61 168.5,-1125.61 165,-1135.61 172,-1135.61\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140152109482448 -->\n",
       "<g class=\"node\" id=\"node5\"><title>140152109482448</title>\n",
       "<polygon fill=\"none\" points=\"45,-996.5 45,-1042.5 292,-1042.5 292,-996.5 45,-996.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"99.5\" y=\"-1015.8\">dense_23: Dense</text>\n",
       "<polyline fill=\"none\" points=\"154,-996.5 154,-1042.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"181.5\" y=\"-1027.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"154,-1019.5 209,-1019.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"181.5\" y=\"-1004.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"209,-996.5 209,-1042.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"250.5\" y=\"-1027.3\">(None, 100)</text>\n",
       "<polyline fill=\"none\" points=\"209,-1019.5 292,-1019.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"250.5\" y=\"-1004.3\">(None, 100)</text>\n",
       "</g>\n",
       "<!-- 140152109471896&#45;&gt;140152109482448 -->\n",
       "<g class=\"edge\" id=\"edge3\"><title>140152109471896-&gt;140152109482448</title>\n",
       "<path d=\"M168.5,-1079.37C168.5,-1071.15 168.5,-1061.66 168.5,-1052.73\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"172,-1052.61 168.5,-1042.61 165,-1052.61 172,-1052.61\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140152109472064 -->\n",
       "<g class=\"node\" id=\"node4\"><title>140152109472064</title>\n",
       "<polygon fill=\"none\" points=\"690,-1079.5 690,-1125.5 953,-1125.5 953,-1079.5 690,-1079.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"752.5\" y=\"-1098.8\">input_8: InputLayer</text>\n",
       "<polyline fill=\"none\" points=\"815,-1079.5 815,-1125.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"842.5\" y=\"-1110.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"815,-1102.5 870,-1102.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"842.5\" y=\"-1087.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"870,-1079.5 870,-1125.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"911.5\" y=\"-1110.3\">(None, 100)</text>\n",
       "<polyline fill=\"none\" points=\"870,-1102.5 953,-1102.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"911.5\" y=\"-1087.3\">(None, 100)</text>\n",
       "</g>\n",
       "<!-- 140149406947256 -->\n",
       "<g class=\"node\" id=\"node6\"><title>140149406947256</title>\n",
       "<polygon fill=\"none\" points=\"698,-996.5 698,-1042.5 945,-1042.5 945,-996.5 698,-996.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"752.5\" y=\"-1015.8\">dense_25: Dense</text>\n",
       "<polyline fill=\"none\" points=\"807,-996.5 807,-1042.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"834.5\" y=\"-1027.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"807,-1019.5 862,-1019.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"834.5\" y=\"-1004.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"862,-996.5 862,-1042.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"903.5\" y=\"-1027.3\">(None, 100)</text>\n",
       "<polyline fill=\"none\" points=\"862,-1019.5 945,-1019.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"903.5\" y=\"-1004.3\">(None, 300)</text>\n",
       "</g>\n",
       "<!-- 140152109472064&#45;&gt;140149406947256 -->\n",
       "<g class=\"edge\" id=\"edge4\"><title>140152109472064-&gt;140149406947256</title>\n",
       "<path d=\"M821.5,-1079.37C821.5,-1071.15 821.5,-1061.66 821.5,-1052.73\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"825,-1052.61 821.5,-1042.61 818,-1052.61 825,-1052.61\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140152109758504 -->\n",
       "<g class=\"node\" id=\"node7\"><title>140152109758504</title>\n",
       "<polygon fill=\"none\" points=\"45,-913.5 45,-959.5 292,-959.5 292,-913.5 45,-913.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"99.5\" y=\"-932.8\">dense_24: Dense</text>\n",
       "<polyline fill=\"none\" points=\"154,-913.5 154,-959.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"181.5\" y=\"-944.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"154,-936.5 209,-936.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"181.5\" y=\"-921.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"209,-913.5 209,-959.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"250.5\" y=\"-944.3\">(None, 100)</text>\n",
       "<polyline fill=\"none\" points=\"209,-936.5 292,-936.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"250.5\" y=\"-921.3\">(None, 1)</text>\n",
       "</g>\n",
       "<!-- 140152109482448&#45;&gt;140152109758504 -->\n",
       "<g class=\"edge\" id=\"edge5\"><title>140152109482448-&gt;140152109758504</title>\n",
       "<path d=\"M168.5,-996.366C168.5,-988.152 168.5,-978.658 168.5,-969.725\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"172,-969.607 168.5,-959.607 165,-969.607 172,-969.607\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140149406961112 -->\n",
       "<g class=\"node\" id=\"node8\"><title>140149406961112</title>\n",
       "<polygon fill=\"none\" points=\"698,-913.5 698,-959.5 945,-959.5 945,-913.5 698,-913.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"752.5\" y=\"-932.8\">dense_26: Dense</text>\n",
       "<polyline fill=\"none\" points=\"807,-913.5 807,-959.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"834.5\" y=\"-944.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"807,-936.5 862,-936.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"834.5\" y=\"-921.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"862,-913.5 862,-959.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"903.5\" y=\"-944.3\">(None, 300)</text>\n",
       "<polyline fill=\"none\" points=\"862,-936.5 945,-936.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"903.5\" y=\"-921.3\">(None, 300)</text>\n",
       "</g>\n",
       "<!-- 140149406947256&#45;&gt;140149406961112 -->\n",
       "<g class=\"edge\" id=\"edge6\"><title>140149406947256-&gt;140149406961112</title>\n",
       "<path d=\"M821.5,-996.366C821.5,-988.152 821.5,-978.658 821.5,-969.725\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"825,-969.607 821.5,-959.607 818,-969.607 825,-969.607\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140149406947144 -->\n",
       "<g class=\"node\" id=\"node10\"><title>140149406947144</title>\n",
       "<polygon fill=\"none\" points=\"0,-830.5 0,-876.5 337,-876.5 337,-830.5 0,-830.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"92.5\" y=\"-849.8\">repeat_vector_5: RepeatVector</text>\n",
       "<polyline fill=\"none\" points=\"185,-830.5 185,-876.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"212.5\" y=\"-861.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"185,-853.5 240,-853.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"212.5\" y=\"-838.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"240,-830.5 240,-876.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"288.5\" y=\"-861.3\">(None, 1)</text>\n",
       "<polyline fill=\"none\" points=\"240,-853.5 337,-853.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"288.5\" y=\"-838.3\">(None, 200, 1)</text>\n",
       "</g>\n",
       "<!-- 140152109758504&#45;&gt;140149406947144 -->\n",
       "<g class=\"edge\" id=\"edge7\"><title>140152109758504-&gt;140149406947144</title>\n",
       "<path d=\"M168.5,-913.366C168.5,-905.152 168.5,-895.658 168.5,-886.725\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"172,-886.607 168.5,-876.607 165,-886.607 172,-886.607\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140152109522560 -->\n",
       "<g class=\"node\" id=\"node11\"><title>140152109522560</title>\n",
       "<polygon fill=\"none\" points=\"698,-830.5 698,-876.5 945,-876.5 945,-830.5 698,-830.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"752.5\" y=\"-849.8\">dense_27: Dense</text>\n",
       "<polyline fill=\"none\" points=\"807,-830.5 807,-876.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"834.5\" y=\"-861.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"807,-853.5 862,-853.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"834.5\" y=\"-838.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"862,-830.5 862,-876.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"903.5\" y=\"-861.3\">(None, 300)</text>\n",
       "<polyline fill=\"none\" points=\"862,-853.5 945,-853.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"903.5\" y=\"-838.3\">(None, 2)</text>\n",
       "</g>\n",
       "<!-- 140149406961112&#45;&gt;140152109522560 -->\n",
       "<g class=\"edge\" id=\"edge8\"><title>140149406961112-&gt;140152109522560</title>\n",
       "<path d=\"M821.5,-913.366C821.5,-905.152 821.5,-895.658 821.5,-886.725\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"825,-886.607 821.5,-876.607 818,-886.607 825,-886.607\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140152109471392 -->\n",
       "<g class=\"node\" id=\"node9\"><title>140152109471392</title>\n",
       "<polygon fill=\"none\" points=\"355,-830.5 355,-876.5 632,-876.5 632,-830.5 355,-830.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"417.5\" y=\"-849.8\">input_9: InputLayer</text>\n",
       "<polyline fill=\"none\" points=\"480,-830.5 480,-876.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"507.5\" y=\"-861.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"480,-853.5 535,-853.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"507.5\" y=\"-838.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"535,-830.5 535,-876.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"583.5\" y=\"-861.3\">(None, 200, 3)</text>\n",
       "<polyline fill=\"none\" points=\"535,-853.5 632,-853.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"583.5\" y=\"-838.3\">(None, 200, 3)</text>\n",
       "</g>\n",
       "<!-- 140149406947032 -->\n",
       "<g class=\"node\" id=\"node12\"><title>140149406947032</title>\n",
       "<polygon fill=\"none\" points=\"254,-747.5 254,-793.5 635,-793.5 635,-747.5 254,-747.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"320\" y=\"-766.8\">multiply_3: Multiply</text>\n",
       "<polyline fill=\"none\" points=\"386,-747.5 386,-793.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"413.5\" y=\"-778.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"386,-770.5 441,-770.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"413.5\" y=\"-755.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"441,-747.5 441,-793.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"538\" y=\"-778.3\">[(None, 200, 3), (None, 200, 1)]</text>\n",
       "<polyline fill=\"none\" points=\"441,-770.5 635,-770.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"538\" y=\"-755.3\">(None, 200, 3)</text>\n",
       "</g>\n",
       "<!-- 140152109471392&#45;&gt;140149406947032 -->\n",
       "<g class=\"edge\" id=\"edge9\"><title>140152109471392-&gt;140149406947032</title>\n",
       "<path d=\"M480.111,-830.366C474.871,-821.705 468.771,-811.622 463.116,-802.274\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"466.044,-800.351 457.873,-793.607 460.055,-803.975 466.044,-800.351\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140149406947144&#45;&gt;140149406947032 -->\n",
       "<g class=\"edge\" id=\"edge10\"><title>140149406947144-&gt;140149406947032</title>\n",
       "<path d=\"M243.554,-830.473C279.454,-819.937 322.588,-807.279 359.674,-796.395\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"360.852,-799.697 369.461,-793.522 358.88,-792.98 360.852,-799.697\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140152107816720 -->\n",
       "<g class=\"node\" id=\"node13\"><title>140152107816720</title>\n",
       "<polygon fill=\"none\" points=\"653,-747.5 653,-793.5 990,-793.5 990,-747.5 653,-747.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"745.5\" y=\"-766.8\">repeat_vector_6: RepeatVector</text>\n",
       "<polyline fill=\"none\" points=\"838,-747.5 838,-793.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"865.5\" y=\"-778.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"838,-770.5 893,-770.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"865.5\" y=\"-755.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"893,-747.5 893,-793.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"941.5\" y=\"-778.3\">(None, 2)</text>\n",
       "<polyline fill=\"none\" points=\"893,-770.5 990,-770.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"941.5\" y=\"-755.3\">(None, 200, 2)</text>\n",
       "</g>\n",
       "<!-- 140152109522560&#45;&gt;140152107816720 -->\n",
       "<g class=\"edge\" id=\"edge11\"><title>140152109522560-&gt;140152107816720</title>\n",
       "<path d=\"M821.5,-830.366C821.5,-822.152 821.5,-812.658 821.5,-803.725\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"825,-803.607 821.5,-793.607 818,-803.607 825,-803.607\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140152107816328 -->\n",
       "<g class=\"node\" id=\"node14\"><title>140152107816328</title>\n",
       "<polygon fill=\"none\" points=\"424,-664.5 424,-710.5 841,-710.5 841,-664.5 424,-664.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"508\" y=\"-683.8\">concatenate_3: Concatenate</text>\n",
       "<polyline fill=\"none\" points=\"592,-664.5 592,-710.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"619.5\" y=\"-695.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"592,-687.5 647,-687.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"619.5\" y=\"-672.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"647,-664.5 647,-710.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"744\" y=\"-695.3\">[(None, 200, 3), (None, 200, 2)]</text>\n",
       "<polyline fill=\"none\" points=\"647,-687.5 841,-687.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"744\" y=\"-672.3\">(None, 200, 5)</text>\n",
       "</g>\n",
       "<!-- 140149406947032&#45;&gt;140152107816328 -->\n",
       "<g class=\"edge\" id=\"edge12\"><title>140149406947032-&gt;140152107816328</title>\n",
       "<path d=\"M495.872,-747.366C519.394,-737.232 547.434,-725.151 571.973,-714.578\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"573.391,-717.778 581.19,-710.607 570.621,-711.349 573.391,-717.778\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140152107816720&#45;&gt;140152107816328 -->\n",
       "<g class=\"edge\" id=\"edge13\"><title>140152107816720-&gt;140152107816328</title>\n",
       "<path d=\"M769.855,-747.366C746.208,-737.232 718.018,-725.151 693.349,-714.578\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"694.653,-711.329 684.083,-710.607 691.895,-717.763 694.653,-711.329\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140152107586280 -->\n",
       "<g class=\"node\" id=\"node15\"><title>140152107586280</title>\n",
       "<polygon fill=\"none\" points=\"415.5,-581.5 415.5,-627.5 849.5,-627.5 849.5,-581.5 415.5,-581.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"550\" y=\"-600.8\">bidirectional_9(lstm_5): Bidirectional(LSTM)</text>\n",
       "<polyline fill=\"none\" points=\"684.5,-581.5 684.5,-627.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"712\" y=\"-612.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"684.5,-604.5 739.5,-604.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"712\" y=\"-589.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"739.5,-581.5 739.5,-627.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"794.5\" y=\"-612.3\">(None, 200, 5)</text>\n",
       "<polyline fill=\"none\" points=\"739.5,-604.5 849.5,-604.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"794.5\" y=\"-589.3\">(None, 200, 400)</text>\n",
       "</g>\n",
       "<!-- 140152107816328&#45;&gt;140152107586280 -->\n",
       "<g class=\"edge\" id=\"edge14\"><title>140152107816328-&gt;140152107586280</title>\n",
       "<path d=\"M632.5,-664.366C632.5,-656.152 632.5,-646.658 632.5,-637.725\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"636,-637.607 632.5,-627.607 629,-637.607 636,-637.607\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140152103140936 -->\n",
       "<g class=\"node\" id=\"node16\"><title>140152103140936</title>\n",
       "<polygon fill=\"none\" points=\"412.5,-498.5 412.5,-544.5 852.5,-544.5 852.5,-498.5 412.5,-498.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"550\" y=\"-517.8\">bidirectional_10(lstm_6): Bidirectional(LSTM)</text>\n",
       "<polyline fill=\"none\" points=\"687.5,-498.5 687.5,-544.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"715\" y=\"-529.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"687.5,-521.5 742.5,-521.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"715\" y=\"-506.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"742.5,-498.5 742.5,-544.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"797.5\" y=\"-529.3\">(None, 200, 400)</text>\n",
       "<polyline fill=\"none\" points=\"742.5,-521.5 852.5,-521.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"797.5\" y=\"-506.3\">(None, 400)</text>\n",
       "</g>\n",
       "<!-- 140152107586280&#45;&gt;140152103140936 -->\n",
       "<g class=\"edge\" id=\"edge15\"><title>140152107586280-&gt;140152103140936</title>\n",
       "<path d=\"M632.5,-581.366C632.5,-573.152 632.5,-563.658 632.5,-554.725\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"636,-554.607 632.5,-544.607 629,-554.607 636,-554.607\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140152102777128 -->\n",
       "<g class=\"node\" id=\"node17\"><title>140152102777128</title>\n",
       "<polygon fill=\"none\" points=\"509,-415.5 509,-461.5 756,-461.5 756,-415.5 509,-415.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"563.5\" y=\"-434.8\">dense_28: Dense</text>\n",
       "<polyline fill=\"none\" points=\"618,-415.5 618,-461.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"645.5\" y=\"-446.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"618,-438.5 673,-438.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"645.5\" y=\"-423.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"673,-415.5 673,-461.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"714.5\" y=\"-446.3\">(None, 400)</text>\n",
       "<polyline fill=\"none\" points=\"673,-438.5 756,-438.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"714.5\" y=\"-423.3\">(None, 200)</text>\n",
       "</g>\n",
       "<!-- 140152103140936&#45;&gt;140152102777128 -->\n",
       "<g class=\"edge\" id=\"edge16\"><title>140152103140936-&gt;140152102777128</title>\n",
       "<path d=\"M632.5,-498.366C632.5,-490.152 632.5,-480.658 632.5,-471.725\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"636,-471.607 632.5,-461.607 629,-471.607 636,-471.607\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140149396463120 -->\n",
       "<g class=\"node\" id=\"node18\"><title>140149396463120</title>\n",
       "<polygon fill=\"none\" points=\"509,-332.5 509,-378.5 756,-378.5 756,-332.5 509,-332.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"563.5\" y=\"-351.8\">dense_29: Dense</text>\n",
       "<polyline fill=\"none\" points=\"618,-332.5 618,-378.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"645.5\" y=\"-363.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"618,-355.5 673,-355.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"645.5\" y=\"-340.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"673,-332.5 673,-378.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"714.5\" y=\"-363.3\">(None, 200)</text>\n",
       "<polyline fill=\"none\" points=\"673,-355.5 756,-355.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"714.5\" y=\"-340.3\">(None, 200)</text>\n",
       "</g>\n",
       "<!-- 140152102777128&#45;&gt;140149396463120 -->\n",
       "<g class=\"edge\" id=\"edge17\"><title>140152102777128-&gt;140149396463120</title>\n",
       "<path d=\"M632.5,-415.366C632.5,-407.152 632.5,-397.658 632.5,-388.725\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"636,-388.607 632.5,-378.607 629,-388.607 636,-388.607\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140149395369712 -->\n",
       "<g class=\"node\" id=\"node19\"><title>140149395369712</title>\n",
       "<polygon fill=\"none\" points=\"494,-249.5 494,-295.5 771,-295.5 771,-249.5 494,-249.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"556.5\" y=\"-268.8\">reshape_3: Reshape</text>\n",
       "<polyline fill=\"none\" points=\"619,-249.5 619,-295.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"646.5\" y=\"-280.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"619,-272.5 674,-272.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"646.5\" y=\"-257.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"674,-249.5 674,-295.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"722.5\" y=\"-280.3\">(None, 200)</text>\n",
       "<polyline fill=\"none\" points=\"674,-272.5 771,-272.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"722.5\" y=\"-257.3\">(None, 100, 2)</text>\n",
       "</g>\n",
       "<!-- 140149396463120&#45;&gt;140149395369712 -->\n",
       "<g class=\"edge\" id=\"edge18\"><title>140149396463120-&gt;140149395369712</title>\n",
       "<path d=\"M632.5,-332.366C632.5,-324.152 632.5,-314.658 632.5,-305.725\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"636,-305.607 632.5,-295.607 629,-305.607 636,-305.607\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140149395115424 -->\n",
       "<g class=\"node\" id=\"node20\"><title>140149395115424</title>\n",
       "<polygon fill=\"none\" points=\"419.5,-166.5 419.5,-212.5 845.5,-212.5 845.5,-166.5 419.5,-166.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"550\" y=\"-185.8\">bidirectional_11(gru_5): Bidirectional(GRU)</text>\n",
       "<polyline fill=\"none\" points=\"680.5,-166.5 680.5,-212.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"708\" y=\"-197.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"680.5,-189.5 735.5,-189.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"708\" y=\"-174.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"735.5,-166.5 735.5,-212.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"790.5\" y=\"-197.3\">(None, 100, 2)</text>\n",
       "<polyline fill=\"none\" points=\"735.5,-189.5 845.5,-189.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"790.5\" y=\"-174.3\">(None, 100, 400)</text>\n",
       "</g>\n",
       "<!-- 140149395369712&#45;&gt;140149395115424 -->\n",
       "<g class=\"edge\" id=\"edge19\"><title>140149395369712-&gt;140149395115424</title>\n",
       "<path d=\"M632.5,-249.366C632.5,-241.152 632.5,-231.658 632.5,-222.725\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"636,-222.607 632.5,-212.607 629,-222.607 636,-222.607\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140152109303456 -->\n",
       "<g class=\"node\" id=\"node21\"><title>140152109303456</title>\n",
       "<polygon fill=\"none\" points=\"419.5,-83.5 419.5,-129.5 845.5,-129.5 845.5,-83.5 419.5,-83.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"550\" y=\"-102.8\">bidirectional_12(gru_6): Bidirectional(GRU)</text>\n",
       "<polyline fill=\"none\" points=\"680.5,-83.5 680.5,-129.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"708\" y=\"-114.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"680.5,-106.5 735.5,-106.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"708\" y=\"-91.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"735.5,-83.5 735.5,-129.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"790.5\" y=\"-114.3\">(None, 100, 400)</text>\n",
       "<polyline fill=\"none\" points=\"735.5,-106.5 845.5,-106.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"790.5\" y=\"-91.3\">(None, 400)</text>\n",
       "</g>\n",
       "<!-- 140149395115424&#45;&gt;140152109303456 -->\n",
       "<g class=\"edge\" id=\"edge20\"><title>140149395115424-&gt;140152109303456</title>\n",
       "<path d=\"M632.5,-166.366C632.5,-158.152 632.5,-148.658 632.5,-139.725\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"636,-139.607 632.5,-129.607 629,-139.607 636,-139.607\" stroke=\"black\"/>\n",
       "</g>\n",
       "<!-- 140149407018176 -->\n",
       "<g class=\"node\" id=\"node22\"><title>140149407018176</title>\n",
       "<polygon fill=\"none\" points=\"509,-0.5 509,-46.5 756,-46.5 756,-0.5 509,-0.5\" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"563.5\" y=\"-19.8\">dense_30: Dense</text>\n",
       "<polyline fill=\"none\" points=\"618,-0.5 618,-46.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"645.5\" y=\"-31.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"618,-23.5 673,-23.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"645.5\" y=\"-8.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"673,-0.5 673,-46.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"714.5\" y=\"-31.3\">(None, 400)</text>\n",
       "<polyline fill=\"none\" points=\"673,-23.5 756,-23.5 \" stroke=\"black\"/>\n",
       "<text font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"714.5\" y=\"-8.3\">(None, 200)</text>\n",
       "</g>\n",
       "<!-- 140152109303456&#45;&gt;140149407018176 -->\n",
       "<g class=\"edge\" id=\"edge21\"><title>140152109303456-&gt;140149407018176</title>\n",
       "<path d=\"M632.5,-83.3664C632.5,-75.1516 632.5,-65.6579 632.5,-56.7252\" fill=\"none\" stroke=\"black\"/>\n",
       "<polygon fill=\"black\" points=\"636,-56.6068 632.5,-46.6068 629,-56.6069 636,-56.6068\" stroke=\"black\"/>\n",
       "</g>\n",
       "</g>\n",
       "</svg>"
      ],
      "text/plain": [
       "<IPython.core.display.SVG object>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from keras.layers import Bidirectional\n",
    "from keras.layers import RepeatVector\n",
    "from keras.layers import multiply\n",
    "from keras.layers import Input\n",
    "from keras.layers import concatenate\n",
    "from keras.models import Model\n",
    "from keras.layers import Reshape\n",
    "from keras.layers import GRU\n",
    "def build_end_to_end_model_regression_larger_bidir_window(preamble_length, data_length, channel_length, output_length):\n",
    "    preamble_cfo = Input(shape=(preamble_length * 2,))\n",
    "    preamble_channel = Input(shape=(preamble_length * 2,))\n",
    "    data = Input(shape=(data_length, 3))\n",
    "    \n",
    "    cfo_layer_1 = Dense(100, activation='tanh', use_bias=True)(preamble_cfo)\n",
    "    cfo_layer_2 = Dense(100, activation='tanh', use_bias=True)(cfo_layer_1)\n",
    "    cfo_layer_3 = Dense(100, activation='tanh', use_bias=True)(cfo_layer_2)\n",
    "    cfo_layer_output = Dense(1, activation='linear', use_bias=True)(cfo_layer_3)\n",
    "    cfo_layer_repeated = RepeatVector(data_length)(cfo_layer_output)\n",
    "    \n",
    "    data_transformed = multiply([data, cfo_layer_repeated])\n",
    "    \n",
    "    preamble_layer_1 = Dense(300, activation='relu')(preamble_channel)\n",
    "    preamble_layer_2 = Dense(300, activation='relu')(preamble_layer_1)\n",
    "    \n",
    "    channel = Dense(channel_length, activation='sigmoid')(preamble_layer_2)\n",
    "    \n",
    "    channel_repeated = RepeatVector(data_length)(channel)\n",
    "    \n",
    "    output = concatenate([data_transformed, channel_repeated])\n",
    "    data_layers = Bidirectional(LSTM(data_length, return_sequences=True))(output)\n",
    "    data_layers_2 = Bidirectional(LSTM(data_length))(data_layers)\n",
    "    \n",
    "    output_1 = Dense(output_length, activation='relu')(data_layers_2)\n",
    "    equalized_data = Dense(output_length, activation='linear')(output_1)\n",
    "    \n",
    "    reshaped_data = Reshape((output_length // 2, 2))(equalized_data)\n",
    "    ecc_layer_1 = Bidirectional(GRU(200, return_sequences=True))(reshaped_data)\n",
    "    ecc_layer_2 = Bidirectional(GRU(200))(ecc_layer_1)\n",
    "    \n",
    "    output = Dense(data_length, activation='linear')(ecc_layer_2)\n",
    "    \n",
    "    model = Model(inputs=[preamble_cfo, preamble_channel, data], outputs=[output])\n",
    "    \n",
    "    model.compile(optimizer='adam', loss='mse', metrics=['mse'])\n",
    "    return model\n",
    "\n",
    "model = build_end_to_end_model_regression_larger_bidir_window(50, 200, 2, 200)\n",
    "from IPython.display import SVG\n",
    "from keras.utils.vis_utils import model_to_dot\n",
    "\n",
    "SVG(model_to_dot(model, show_shapes=True, show_layer_names=True).create(prog='dot', format='svg'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
